package com.angel.domain.angelmission.aggregates;

import com.angel.domain.angelmission.entities.AngelMissionInfo;
import com.angel.domain.angelmission.valueobjects.AngelMissionId;
import com.angel.domain.angeluser.valueobjects.AngelUserId;
import com.angel.domain.angeluser.valueobjects.CreateInfo;
import lombok.Getter;

import java.util.concurrent.atomic.AtomicReference;

/*
 * 更新关注微信公众号： 为了offer
 * @author parkin
 * @description 用户任务  比如留言求助信息 完善用户信息
 * @date 2021/11/16
 */
@Getter
public class AngelMission {

    private AngelMissionId angelMissionId;

    // 关联的用户
    private AngelUserId angelUserId;

    private AtomicReference<State> missionState = null;

    // 任务详情
    private AngelMissionInfo angelMissionInfo;

    private CreateInfo createInfo;

    private AngelMission() {}

    public AngelMission( AngelUserId angelUserId,AngelMissionInfo angelMissionInfo) {
        this.angelMissionId = new AngelMissionId();
        this.angelUserId = angelUserId;
        this.angelMissionInfo = angelMissionInfo;
        this.missionState = new AtomicReference<>(State.WAIT);
        this.createInfo = new CreateInfo(this.angelUserId);
    }

    /**
     * 任务状态
     */
    public enum State {
        /**
         * 等待完成
         */
        WAIT,
        /**
         * 已经完成
         */
        COMPLETED
    }

    // 完成任务 —》发出事件 -》增加经验值
    public void completeAngelMission() {

    }
}
